nautil
Class Utility

public class Utility

Title: Notarization Authority Utilities

Description:

Copyright: Copyright (c) 2003

Company: UCSC

Version:
1.0
Author:
H.E.M.H.B. Ekanayake
Method Detail

toHex

public StringBuffer toHex(byte[] data)
Converts a byte array to the corresponding hex representation and returns the resulting buffered string
Parameters:
data - input byte array
Returns:
hex buffer

toString

public StringBuffer toString(byte[] data)
Converts a byte array into corresponding character representation and returns the resulting buffered string
Parameters:
data -
Returns:
character buffer

toInt

public int toInt(String number,
                 int defaultvalue)
Converts a string containg a number into the corresponding integer value, or returns the default value if failed
Parameters:
number - string number
defaultvalue - default integer value
Returns:
integer value

concatArray

public byte[] concatArray(byte[] arrayA,
                          byte[] arrayB)
Concatenates two byte arrays and returns the resulting byte array.
Parameters:
arrayA - first byte array
arrayB - second byte array
Returns:
concatenated byte array

getSerial

public String getSerial(String prefix)
This method returns a randomized serial number in the form of a string. E.g. getSerial("ABC") ==> "ABC10531597126840.4953822Adm64"
Parameters:
prefix - adds to the beginning of the serial number.
Returns:
the serial number

getEnclosed

public String getEnclosed(String pre,
                          String post,
                          String in)
Returns the string between two strings. E.g. getEnclosed("<", ">", "") ==> "Between"
Parameters:
pre - string
post - string
in - input string
Returns:
string between